
<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <button :style="isstyle == '按钮1' ? style1 :''" @click="click1">按钮1</button>
        <button :style="isstyle == '按钮2' ? style1 :''" @click="click1">按钮2</button>
        <button :style="isstyle == '按钮3' ? style1 :''" @click="click1">按钮3</button>

    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                isstyle:'',
                style1:{
                    background:'red',
                    color:'green',
                }
            },
            methods: {
                click1(event){
                    // console.log(event.target.innerText);                    
                    this.isstyle = event.target.innerText;
                }
            }
        })
    </script>
</body>

</html>